﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using EnvDTE;

namespace GordonKristan.codeclean
{
	using System.Collections;
	using System.Windows.Forms;

	public class StringContainerSorter : IComparer
	{
		private bool reverse;

		/// <summary>
		/// Constructor
		/// </summary>
		/// <param name="aReverse">True to sort backwards, else false</param>
		public StringContainerSorter(bool aReverse)
		{
			reverse = aReverse;
		}

		/// <summary>
		/// Performs a comparison on two CommentContainers
		/// </summary>
		public int Compare(object x, object y)
		{
			StringContainer cx = (StringContainer)x;
			StringContainer cy = (StringContainer)y;
			if (reverse)
			{
				return cy.start - cx.start;
			}
			else
			{
				return cx.start - cy.start;
			}
		}
	}
}
